/// 点赞记录数据模型
/// 记录用户对问题的点赞关系
class LikeRecordEssence {
  final String userId;
  final String targetId;

  LikeRecordEssence({required this.userId, required this.targetId});

  /// 从Map创建LikeRecordEssence
  factory LikeRecordEssence.fromMap(Map<String, dynamic> map) {
    return LikeRecordEssence(
      userId: map['userId'] as String,
      targetId: map['targetId'] as String,
    );
  }

  /// 转换为Map
  Map<String, dynamic> toMap() {
    return {'userId': userId, 'targetId': targetId};
  }

  @override
  bool operator ==(Object other) {
    if (identical(this, other)) return true;
    return other is LikeRecordEssence &&
        other.userId == userId &&
        other.targetId == targetId;
  }

  @override
  int get hashCode => userId.hashCode ^ targetId.hashCode;
}
